/**
 * @filename TaskService.java
 * @directory /src/com/tianjian/oa/task/services
 * @package com.tianjian.oa.task.service
 * @description 文件描述
 * @author 胡世君
 * @date 2013-05-07 22:28:58
 * @version v0.1
 */
package com.tianjian.oa.task.services;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.tianjian.common.Criteria;
import com.tianjian.oa.task.pojos.Task;
import com.tianjian.oa.task.mapper.TaskMapper;

/**
 * @author 胡世君
 */
@Service
public class TaskService {

	@Autowired
	private TaskMapper taskMapper;

	/**
	 * 获取列表
	 * @param criteria
	 * @return
	 */
	public List<Task> getData(Criteria criteria) {
		try {
			return taskMapper.getData(criteria);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

	/**
	 * 获取总数
	 * @param criteria
	 * @return
	 */
	public int getCount(Criteria criteria) {
		try {
			return taskMapper.getCount(criteria);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return 0;
	}

	/**
	 * 添加用户
	 * @return
	 */
	public int add(Task task) {
		try {
			return taskMapper.insert(task);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return 0;
	}

	/**
	 * 编辑
	 * @return
	 */
	public int edit(Task task) {
		try {
			return taskMapper.update(task);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return 0;
	}

	/**
	 * 删除
	 * @return
	 */
	public int del(String id) {
		try {
			return taskMapper.delete(id);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return 0;
	}

}
